<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ page import="com.gouwudai.gobbs.pojo.TbbsUserInfo"%>
<%@ include file="../common/common.jsp" %>
<%@ include file="user_pass2.jsp" %>
<%
IUserService userService = (IUserService)BeanManager.getBean("userService");
TbbsUserInfo obj = userService.load(userLogin.getUserId());
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><%=SYSTITLE%> - 修改社区形象</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Keywords" content="<%=SYSMETAKEY%>" />
<meta name="Description" content="<%=SYSMETADESC%>" />
<%@ include file="../common/meta.inc" %>
<link rel="stylesheet" type="text/css" href="css/defaultStyle.css" >
</head>
<body>
<%@ include file="../common/waiting.inc" %>
<SCRIPT language="javascript">

setStatus('<%=SYSTITLE%> - 工具箱');
</SCRIPT>
<script language="javascript" src="${pageContext.request.contextPath}/scripts/common-validator.js"></script>
<script language="javascript" src="${pageContext.request.contextPath}/scripts/prototype.js"></script>
<script language="javascript" src="${pageContext.request.contextPath}/scripts/buffalo/buffalo.js"></script>
<script language="javascript">
var END_POINT="${pageContext.request.contextPath}/buffalo";
var buffalo = new Buffalo(END_POINT);

function doSubmit() {

	form = document.theform;
	
	if(!validateForm(form))
		return;
		
    var personalPic = form.personalPic.value;
	
	var retMsg = "更新用户头像成功！";
    buffalo.remoteCall("userServiceAjaxService.updatePersonalPic",[personalPic,<%=userLogin.getUserId()%>], function(reply) {
        ajaxSubmit(reply.getResult(),retMsg);
    });
}

function validateForm(form)
{
	if(!sl_check(form.personalPic,"个人头像",200,1)) return false;	
    return true;
}


function changePic(obj)
{
	if(obj.selectedIndex>0)
	{
		document.images['userHead'].src=obj.value;
		document.theform.personalPic.value=obj.value;	
	}
}

function reloadImg()
{
	if(trim(document.theform.personalPic.value).length>0)
		document.images['userHead'].src=document.theform.personalPic.value;
	return false;
}
</script>
<script language="javascript" type="text/javascript" src="template/scripts/topBar.js"></script>
<DIV class="line"></DIV>
<DIV class="list_table_0">
<%=HtmlConst.navMenu("user_head.jsp","自定义个人头像 ")%>
</DIV>
<DIV class="line"></DIV>
<form name="theform" onSubmit="return validateForm(this);">
<table width="100%" border="0" align="center" cellpadding="4" cellspacing="1" class="tab">
	<tr>
		<td width="120" class="tab1"><strong>预览</strong></td>
		<td class="bg2"><img  src="<%=Utility.trimNull(obj.getPersonalPic(),basePath+"club/images/imgErr.gif")%>" title="用户头像" alt="图片地址无效" border="0" align="absmiddle" id="userHead">
		&gt;&gt;<a href="#" target="_self" onclick="reloadImg();return false;">重新载入</a></td>
</tr>
<tr>
<td class="tab1"><strong>修改图片地址</strong></td>
<td class="bg2">
<input id="personalPic" name="personalPic" type="text" value="<%=Utility.trimNull(obj.getPersonalPic())%>" title="请输入全路径名" size="50" />
<select name="userHeads" onChange="changePic(this);">
<%=Arguments.getUserHeadsOptions(basePath,LOGIN_ID,obj.getPersonalPic()) %>
</select></td>
</tr>
<tr>
	<td class="tab1"><strong>上传头像</strong></td>
	<td class="bg2"> 
	<%if(SYSINFO.getUserpicOpenFlag().booleanValue()&&obj.getPicOpenFlag().booleanValue()) {%>
		<iframe name="uploadImg" frameborder=0 width="100%" height="30" scrolling=no src="uploading/index.jsp?uploadType=3" allowTransparency="true"></iframe>
	<%} else out.print("<span style=\"remark\">此功能被关闭</span>");%>
	</td>
</tr>
<tr>
	<td class="tab1">&nbsp;</td>
	<td class="bg2"><input type="button" name="btnSubmit" value="提交" class="btn" onclick="javascript:doSubmit();"></td>  
</tr>
</table>
</form>
<%=COPYRIGHTFOOT%>
<%@ include file="../common/foot.inc"%>
</body>
</html>